import RequestUtils from '@/utils/RequestUtils'

export default {
	/**
	 * 新增
	 * @param params
	 * @returns {AxiosPromise}
	 */
	add(params = {}) {
		return RequestUtils({
			url: `/order/salesOrderItem`,
			method: 'POST',
			data: {
				...params
			}
		})
	},
	/**
	 * 批量删除（多个用逗号隔开）
	 * @param ids
	 * @returns {AxiosPromise}
	 */
	remove(ids) {
		return RequestUtils({
			url: `/order/salesOrderItem/${ids}`,
			method: 'DELETE'
		})
	},
	/**
	 * 修改
	 * @param params
	 * @returns {AxiosPromise}
	 */
	edit(params = {}) {
		return RequestUtils({
			url: `/order/salesOrderItem/${params.id}`,
			method: 'PUT',
			data: {
				...params
			}
		})
	},
	/**
	 * 详情
	 * @param id
	 * @returns {AxiosPromise}
	 */
	get(id) {
		return RequestUtils({
			url: `/order/salesOrderItem/${id}`,
			method: 'GET'
		})
	},
	/**
	 * 列表
	 * @param params
	 * @returns {AxiosPromise}
	 */
	list(params = {}) {
		return RequestUtils({
			url: `/order/salesOrderItem/search`,
			method: 'POST',
			data: {
				...params
			}
		})
	},
	/**
	 * 列表-分页
	 * @param params
	 * @returns {AxiosPromise}
	 */
	page(params = {}, page) {
		return RequestUtils({
			url: `/order/salesOrderItem/search/${page.current}/${page.pageSize}`,
			method: 'POST',
			data: {
				...params
			}
		})
	},
	retrieveOrders() {
		return RequestUtils({
			url: `/order/salesOrderItem/readMq`,
			method: 'POST'
		})
	},
	importAgain(id) {
		return RequestUtils({
			url: `/order/salesOrderItem/importAgain/${id}`,
			method: 'PUT'
		})
	},
	createReturn(params) {
		if (!params) params = {}
		return RequestUtils({
			url: `/order/salesOrderItem/createReturn`,
			method: 'post',
			data: {
				...params
			}
		})
	},
	/**
	 * 单品销售排行视图
	 * @param params
	 * @returns {AxiosPromise}
	 */
	skuRateView(params = {}, page) {
		return RequestUtils({
			url: `/order/salesOrderItem/skuRateView/${page.current}/${page.pageSize}`,
			method: 'POST',
			data: {
				...params
			}
		})
	},
	/**
	 * 导出
	 * @param params
	 * @returns {AxiosPromise}
	 */
	exportData(params = {}) {
		return RequestUtils({
			url: `/order/salesOrderItem/exportData`,
			method: 'POST',
			data: {
				...params
			}
		})
	},
	//提交惠单
	submit(params = {}) {
		return RequestUtils({
			url: '/baoli/finCreditBill',
			method: 'POST',
			data: {
				...params
			}
		})
	},
	getList(params = {}, page) {
		return RequestUtils({
			url: `/baoli/finCreditBill/search/${page.current}/${page.pageSize}`,
			method: 'POST',
			data: {
				...params
			}
		})
	}
}
